package com.inputstream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-28
 */
public class Test {
    public static void main(String[] args) {
        String fileParent = "D:\\CScode\\code\\java_code\\2024\\t0728\\src\\com";
        String fileSon = "hello.txt";
        File fileName = new File(fileParent, fileSon);

        FileInputStream fileInput = null;
        try {
            fileInput = new FileInputStream(fileName);
            int readLen = 0;
            byte[] bytes = new byte[3];
            while ((readLen = fileInput.read(bytes)) != -1) {
                System.out.print(new String(bytes, 0, readLen));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileInput.close();
            } catch (IOException e) {
                System.out.println("fileInput关闭失败！");
            }
        }

    }
}
